from lin_base import *

def add_lin_sign(paper,title,x0,y0,xend,font=unicode_font_36,
                    fgcolor=BLACK,lw=2):
    ecl_ras = g_share.ecl_ras
    layer=paper.add_layer(name='sign')
    draw = layer.draw
    draw.text((x0-XM_TITLE,y0+YM_TEXT),title, font=font,fill=fgcolor)
    for j in range(360):
        ra = ecl_ras[j]
        #print(j,ra)
        if (j % 15)> 0:
            continue
        i = int(j / 15)
        ra_hr = ra/15
        xs=RA_to_xs(x0,xend, ra_hr)
        for x in xs:   
            si,sr = divmod(i,2)
            if sr==0:
                sx = SIGNS[si]
                draw.line([(x,y0),(x,y0+YM_LONG)],fill=fgcolor,width=lw) 
                draw.text((x,y0+YM_TEXT),sx, font=font,fill=fgcolor)
                
    draw.line([(x0,y0),(xend,y0)],fill=BLACK,width=2)